package com.bluesky.page;

public class PageQuery implements IPageQuery {

    /**
     * 页码，从1开始
     */
    private int pageNum = 1;

    /**
     * 每页大小
     */
    private int pageSize = 10;

    /**
     * 是否需要统计总行数
     */
    private boolean count = true;

    /**
     * 获取分页请求参数
     * @param pageNum   页码，从1开始
     * @param pageSize  每页大小
     * @param count     是否需要统计总行数
     * @return
     */
    public static PageQuery of(int pageNum,int pageSize,boolean count){
        return new PageQuery(pageNum,pageSize,count);
    }

    public PageQuery(){

    }

    public PageQuery(int pageNum,int pageSize,boolean count){
        this.pageNum = pageNum;
        this.pageSize =  pageSize;
        this.count = count;
    }


    @Override
    public int getPageNum() {
        return pageNum;
    }

    @Override
    public int getPageSize() {
        return pageSize;
    }


    public void setPageNum(int pageNum) {
        this.pageNum = pageNum;
    }

    public void setPageSize(int pageSize) {
        this.pageSize = pageSize;
    }

    public boolean isCount() {
        return count;
    }

    public void setCount(boolean count) {
        this.count = count;
    }


    @Override
    public boolean count() {
        return this.count;
    }
}
